﻿<!DOCTYPE html>
<html lang="en">
<head>
    <title id='Description'>This demo demonstrates all events of the jqxSortable plugin.</title>
    <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
    <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxscrollbar.js"></script>
    <script type="text/javascript" src="../../jqwidgets/globalization/globalize.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxsortable.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxpanel.js"></script>
    <script type="text/javascript" src="../../scripts/demos.js"></script>
    <style>
        #sortable {
            margin: 2px;
            padding: 5px;
            float: left;
            width: 200px;
            border: lightblue solid 1px;
        }

        #events {
            margin: 2px;
            padding: 5px;
            float: left;
            width: 400px;
        }

            #events span {
                font-weight: bold;
            }

        #sortable div {
            border: 1px solid transparent;
        }

        #sortable div {
            border-radius: 5px;
            cursor: pointer;
            padding: 5px;
            background-color: white;
            color: black;
        }

            #sortable div:hover {
                border: 1px solid #356AA0;
            }
    </style>
    <script type="text/javascript">
        $(document).ready(function () {

            var firstNames = ["Nancy", "Andrew", "Janet", "Margaret", "Steven"];
            var lastNames = ["Davolio", "Fuller", "Leverling", "Peacock", "Buchanan"];
            var titles = ["Sales Representative", "Vice President, Sales", "Sales Representative", "Sales Representative", "Sales Manager"];

            var sortableList = '';
            for (var i = 0; i < firstNames.length; i++) {
                var imgurl = '../../images/' + firstNames[i].toLowerCase() + '.png';
                var img = '<img height="50" width="40" src="' + imgurl + '"/>';
                var element = '<div><table style="min-width: 130px;"><tr><td style="width: 40px;" rowspan="2">' + img + '</td><td>' + firstNames[i] + " " + lastNames[i] + '</td></tr><tr><td>' + titles[i] + '</td></tr></table></div>';
                sortableList = sortableList + element;
            }

            $("#sortable").html(sortableList);
            $("#sortable").jqxSortable({ opacity: 0.5 });

            $('#events-container').jqxPanel({ height: 250, width: 200 });
            $('#events-container').css('border', 'none');

            $('#sortable').on('activate beforeStop change deactivate out over receive remove start stop update create', function (e) {
                $('#events-container').jqxPanel('prepend', '<div style="margin-top: 5px;">' + e.type + '</div>');
            });
        });
    </script>
</head>
<body>
    <div id="sortable"></div>
    <div id='events'>
        <span>Events:
        </span>
        <div id='events-container'>
        </div>
    </div>
</body>
</html>
